package com.zkthink.ceres.member.entity;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;
import static com.zkthink.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.zkthink.base.entity.Entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;
import javax.validation.constraints.NotNull;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * <p>
 * 实体类 商城会员信息
 * </p>
 *
 * @author kellen
 * @since 2020-07-12
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("ceres_member")
@ApiModel(value = "Member", description = "商城会员信息")
@AllArgsConstructor
public class Member extends Entity<Long> {

    private static final long serialVersionUID = 1L;

    /**
     * 会员微信OPENID
     */
    @ApiModelProperty(value = "会员微信OPENID")
    @Length(max = 100, message = "会员微信OPENID长度不能超过100")
    @TableField(value = "openid", condition = LIKE)
    @Excel(name = "会员微信OPENID")
    private String openid;

    /**
     * 会员手机号
     */
    @ApiModelProperty(value = "会员手机号")
    @Length(max = 16, message = "会员手机号长度不能超过16")
    @TableField(value = "phone", condition = LIKE)
    @Excel(name = "会员手机号")
    private String phone;

    /**
     * 登录密码
     */
    @ApiModelProperty(value = "登录密码")
    @Length(max = 64, message = "登录密码长度不能超过64")
    @TableField(value = "password", condition = LIKE)
    @Excel(name = "登录密码")
    private String password;

    /**
     * 余额支付密码
     */
    @ApiModelProperty(value = "余额支付密码")
    @Length(max = 100, message = "余额支付密码长度不能超过100")
    @TableField(value = "pay_password", condition = LIKE)
    @Excel(name = "余额支付密码")
    private String payPassword;

    /**
     * 会员昵称
     */
    @ApiModelProperty(value = "会员昵称")
    @Length(max = 20, message = "会员昵称长度不能超过20")
    @TableField(value = "nickname", condition = LIKE)
    @Excel(name = "会员昵称")
    private String nickname;

    /**
     * 会员头像
     */
    @ApiModelProperty(value = "会员头像")
    @Length(max = 500, message = "会员头像长度不能超过500")
    @TableField(value = "headimg", condition = LIKE)
    @Excel(name = "会员头像")
    private String headimg;

    /**
     * 用户类型 1-普通用户 2-商家用户 3-核销人员
     */
    @ApiModelProperty(value = "用户类型 1-普通用户 2-商家用户 3-核销人员")
    @TableField("user_type")
    @Excel(name = "用户类型 1-普通用户 2-商家用户 3-核销人员", replace = {"是_true", "否_false", "_null"})
    private Integer userType;

    /**
     * 性别
     */
    @ApiModelProperty(value = "性别")
    @Length(max = 2, message = "性别长度不能超过2")
    @TableField(value = "sex", condition = LIKE)
    @Excel(name = "性别")
    private String sex;

    /**
     * 1=vip
     */
    @ApiModelProperty(value = "会员级别 1=vip")
    @TableField("level")
    @Excel(name = "会员级别")
    private Integer level;

    /**
     * 默认收货地址
     */
    @ApiModelProperty(value = "默认收货地址")
    @TableField("address_id")
    @Excel(name = "默认收货地址")
    private Long addressId;

    /**
     * 会员个性签名
     */
    @ApiModelProperty(value = "会员个性签名")
    @Length(max = 500, message = "会员个性签名长度不能超过500")
    @TableField(value = "remark", condition = LIKE)
    @Excel(name = "会员个性签名")
    private String remark;

    /**
     * 会员状态0正常 1拉黑
     */
    @ApiModelProperty(value = "会员状态0正常 1拉黑")
    @TableField("status")
    @Excel(name = "会员状态0正常 1拉黑", replace = {"是_true", "否_false", "_null"})
    private Boolean status;

    /**
     * 最后一次登录时间
     */
    @ApiModelProperty(value = "最后一次登录时间")
    @TableField("login_time")
    @Excel(name = "最后一次登录时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime loginTime;

    /**
     * 登录次数
     */
    @ApiModelProperty(value = "登录次数")
    @TableField("login_num")
    @Excel(name = "登录次数")
    private Integer loginNum;

    /**
     * 是否为分销商 0 否 1 是
     */
    @ApiModelProperty(value = "是否为分销商 0 否 1 是")
    @TableField("is_distribute")
    @Excel(name = "是否为分销商 0 否 1 是", replace = {"是_true", "否_false", "_null"})
    private Boolean isDistribute;

    /**
     * 第一个上级
     */
    @ApiModelProperty(value = "第一个上级")
    @TableField("first_leader")
    @Excel(name = "第一个上级")
    private Long firstLeader;

    /**
     * 第二个上级
     */
    @ApiModelProperty(value = "第二个上级")
    @TableField("second_leader")
    @Excel(name = "第二个上级")
    private Long secondLeader;

    /**
     * 第三个上级
     */
    @ApiModelProperty(value = "第三个上级")
    @TableField("third_leader")
    @Excel(name = "第三个上级")
    private Long thirdLeader;

    /**
     * 消费总额
     */
    @ApiModelProperty(value = "消费总额")
    @NotNull(message = "消费总额不能为空")
    @TableField("expend_amount")
    @Excel(name = "消费总额")
    private Long expendAmount;

    /**
     * 购买次数
     */
    @ApiModelProperty(value = "购买次数")
    @NotNull(message = "购买次数不能为空")
    @TableField("buy_times")
    @Excel(name = "购买次数")
    private Integer buyTimes;

    /**
     * 最近一次购买时间
     */
    @ApiModelProperty(value = "最近一次购买时间")
    @TableField("last_buy_time")
    @Excel(name = "最近一次购买时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime lastBuyTime;

    /**
     * 积分
     */
    @ApiModelProperty(value = "积分")
    @TableField("integral")
    @Excel(name = "积分")
    private BigDecimal integral;


    @ApiModelProperty(value = "登录用户名")
    @TableField("account")
    private String account;
    /**
     * 车牌号
     */
    @ApiModelProperty(value = "车牌号")
    @TableField("license_plate")
    private String licensePlate;
    /**
     * vip到期时间
     */
    @ApiModelProperty(value = "vip到期时间")
    @TableField("vip_time")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")

    private LocalDateTime vipTime;
    /**
     * 消费金
     */
    @ApiModelProperty("消费金")
    @TableField("coupons")
    private BigDecimal coupons;
    /**
     * 余额
     */
    @ApiModelProperty("余额")
    @TableField("balance")
    private BigDecimal balance;

    @ApiModelProperty(value = "推荐人电话")
    @TableField("refer_phone")
    private String referPhone;
    @ApiModelProperty(value = "提成")
    @TableField("tichneg")
    private BigDecimal tichneg;
    @ApiModelProperty(value = "微信")
    @TableField("weChat")
    private String weChat;
    @ApiModelProperty(value = "支付宝")
    @TableField("Alipay")
    private String alipay;
    @ApiModelProperty(value = "银行卡")
    @TableField("pay_card")
    private String payCard;

    /**
     * 角色类型(0:商家、1:理疗车)
     */
    @ApiModelProperty(value = "角色类型(0:商家、1:理疗车)")
    @TableField("role_type")
    @Excel(name = "角色类型(0:商家、1:理疗车)")
    private Integer roleType;

    @ApiModelProperty(value = "地区")
    @TableField("city")
    @Excel(name = "地区")
    private String city;

    
    @Builder
    public Member(Long id, LocalDateTime createTime, LocalDateTime updateTime, Long createUser,
                  Long updateUser,
                  String openid, String phone, String password, String payPassword, String nickname,
                  String headimg, Integer userType, String sex, Integer level, Long addressId, String remark,
                  Boolean status, LocalDateTime loginTime, Integer loginNum, Boolean isDistribute,
                  Long firstLeader, Long secondLeader,
                  Long thirdLeader, Long expendAmount, Integer buyTimes, LocalDateTime lastBuyTime,
                  BigDecimal integral, String account,BigDecimal tichneg,Integer roleType) {
        this.id = id;
        this.createTime = createTime;
        this.updateTime = updateTime;
        this.createUser = createUser;
        this.updateUser = updateUser;
        this.openid = openid;
        this.phone = phone;
        this.password = password;
        this.payPassword = payPassword;
        this.nickname = nickname;
        this.headimg = headimg;
        this.userType = userType;
        this.sex = sex;
        this.level = level;
        this.addressId = addressId;
        this.remark = remark;
        this.status = status;
        this.loginTime = loginTime;
        this.loginNum = loginNum;
        this.isDistribute = isDistribute;
        this.firstLeader = firstLeader;
        this.secondLeader = secondLeader;
        this.thirdLeader = thirdLeader;
        this.expendAmount = expendAmount;
        this.buyTimes = buyTimes;
        this.lastBuyTime = lastBuyTime;
        this.integral = integral;
        this.account = account;
        this.tichneg = tichneg;
        this.roleType = roleType;
    }


}
